#!/usr/bin/ruby
# -*- ruby -*-
#
# http://www.reddit.com/r/dailyprogrammer/comments/19rkqr/030613_challenge_121_intermediate_bytelandian/

def m(i)
  a = i / 2
  b = i / 3
  c = i / 4

  return (a + b + c > i) ? m(a) + m(b) + m(c) : i
end

ARGV.each do |i|
  i = i.to_i

  puts "#{i} => #{m(i)}"
end
